Skip to content

Conversation

@Wellshh
Copy link

@Wellshh Wellshh commented Nov 19, 2025

I have some experience in latex2typst conversion, where using pandoc is a more robust and scalable solution (I have tried tex2typst as well).

However, this means when deploying to production server, may need to download the pandoc binary. For development, I have written the docker file.
This pull request introduces a Docker-based development and testing workflow, adds a Pandoc-powered LaTeX-to-Typst conversion service with concurrency control, and implements comprehensive automated tests for both client and server conversion logic. The changes also include new configuration files for Docker and testing, updates to dependencies, and improvements to the build pipeline.

Dockerization and CI/CD improvements:

  • Added Dockerfile and docker-compose.yaml to enable containerized development, testing, and production builds for the app, including multi-stage builds for development, test, and production environments. (Dockerfile, docker-compose.yaml) [1] [2]
  • Updated .github/workflows/ci.yml to build and run tests, linting, and typechecking inside Docker containers for improved environment consistency. (.github/workflows/ci.yml) [1] [2]
  • Added .dockerignore to exclude unnecessary files from Docker build context. (.dockerignore)

LaTeX-to-Typst conversion service:

  • Implemented a server API endpoint (server/api/convert/typst.post.ts) and a Pandoc process manager (server/utils/pandocManager.ts) to convert LaTeX to Typst using Pandoc, with concurrency limits and timeout handling. (server/api/convert/typst.post.ts, server/utils/pandocManager.ts) [1] [2]
  • Refactored client-side conversion logic in app/composables/textProcessor.ts to support both local and server-based conversion, with caching and runtime detection. (app/composables/textProcessor.ts, app/composables/types/pandoc.ts) [1] [2]

Automated testing enhancements:

  • Added Vitest configuration (vitest.config.ts), test scripts to package.json, and dependencies for unit and Nuxt environment tests. (vitest.config.ts, package.json) [1] [2] [3]
  • Implemented unit tests for Pandoc manager concurrency, error handling, and real process execution in Docker (test/unit/pandocManager.spec.ts).
  • Added Nuxt environment tests for client-side conversion caching logic (test/nuxt/textProcessor.cache.spec.ts).

Miscellaneous improvements:

  • Updated build and test dependencies, added new modules for testing and concurrency control, and enabled Nuxt test utilities in nuxt.config.ts. (package.json, nuxt.config.ts) [1] [2]
  • Minor refactor in app/pages/ocr.vue to use async conversion for clipboard copying. (app/pages/ocr.vue)

@vercel
Copy link

vercel bot commented Nov 19, 2025

@Wellshh is attempting to deploy a commit to the alephpi's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for texocr ready!

Name Link
🔨 Latest commit 907ebd0
🔍 Latest deploy log https://app.netlify.com/projects/texocr/deploys/691de1e249a0a100083ab30d
😎 Deploy Preview https://deploy-preview-6--texocr.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@alephpi
Copy link
Owner

alephpi commented Nov 19, 2025

Wow thank you for your PR, that was a big amount of work. However, I'm not intended to maintain a server for this project at the moment(especially for this tiny conversion feature), that's why I made the Texo model running entirely in the browser and take advantage of the free SSG at Netlify. It would be better if you can make pandoc run entirely in the frontend (maybe via wasm? But still what would be the wasm size of pandoc? After all you know the onnxruntime-wasm is ~20MB, if we have something way more bigger, it won't be reasonable to deliver this. But if we only need the latex2typst subset functionality of pandoc , maybe it won't be very large)

I don't mean to waste your valuable effort. Maybe you should have opened a feature request before submit the PR so we could swap opinions on the solution.

Of course, if you can afford a server, don't hesitate to deploy this solution on your own.

@Wellshh
Copy link
Author

Wellshh commented Nov 19, 2025

Thank you so much for the quick and incredibly detailed feedback! I really admired ur work so that’s why I’m submitted this PR. I didn’t know much about the WASM thing, maybe I should dig into it later.
Mitex seems like a better solution now that I think of it and the I totally agree with u since the fact that typyst conversion is so tiny a feature.

@alephpi
Copy link
Owner

alephpi commented Nov 19, 2025

I happen to check pandoc wasm solutions just now, like here, however according to this PR, the memory usage is kind of insane, so I doubt its feasibility. Another decrepated solution is here, but the conversion result in the demo page is not very satisfying(perhaps due to the old version)
image
Would you check if the latex code for the first example image 2^{2^{\operatorname*{lim}_{n\rarr\infin}\left({\frac{1}{2}}\right)^{n}}90^{\circ}f|_{x=1}} is converted well by latest pandoc?
Mitex is good, but it also fails to convert directly usable typst code for this example. Maybe just use Mitex-wrapped LaTeX for typst users.
Or improve tex2typst or tex2typ which based on KaTeX parser, if you think it worths doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants